package model.entityInclude;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import model.entity.ReinsuranceEnsuredEntity;

import baseclass.BaseBill;

/**
 * 
 * 處理檔案
 * 
 **/
public class ReinsuranceEnsured extends BaseBill<ReinsuranceEnsuredEntity>
{
    private static final long serialVersionUID=1L;
    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    public List inFile(String path) throws IOException
    {
	inFile=new InputStreamReader(new FileInputStream(path),"ISO8859_1");
	brFile=new BufferedReader(inFile);
	while ((Line=brFile.readLine())!=null)
	{
	    ReinsuranceEnsuredEntity bill=new ReinsuranceEnsuredEntity();
	    bill.setWORK_ENDOR_CESSION_NO((Line.substring(0,10)));
	    bill.setWORK_CESSION(Line.substring(10,20));
	    bill.setWORK_PLY(Line.substring(20,32));
	    bill.setWORK_ENDOR_NO(Line.substring(32,44));
	    bill.setWORK_ADD_AMT(Line.substring(44,58));
	    bill.setWORK_SUBSTRACT_AMT(Line.substring(58,72));
	    bill.setWORK_ADD_PREM(Line.substring(72,86));
	    bill.setWORK_SUBSTRACT_PREM(Line.substring(86,100));
	    bill.setWORK_AVG_RATE_N(Line.substring(100,107));
	    bill.setWORK_AVG_RATE_O(Line.substring(107,114));
	    bill.setWORK_DAYS(Line.substring(114,117));
	    bill.setWORK_DAYSA(Line.substring(117,120));
	    bill.setType(Line.substring(120,121));
	    bills.add(bill);
	}
	return bills;
    }

}
